import { get, post, IList } from "./index";
export interface Department {
    department: string;
    id: number;
    userCount: number;
}
// 获取部门列表
export const getDepartments = async (department: string): Promise<Department[]> => {
    const res = await post("/user/departmentList", { department });
    return res.data || [];
};

interface StaffsQuery {
    departmentId: number;
    page: number;
    pageSize: number;
}

export interface Staff {
    account: string;
    email: string;
    id: number;
    roleName: string;
    roleId?: number;
}

// 获取实验室用户列表
export const getStaffs = async (data: StaffsQuery): Promise<IList<Staff>> => {
    const res = await post("/user/list", data);
    return {
        total: res.data.total || 0,
        list: res.data.userDtoList || [],
    };
};

interface UpdateRole {
    roleId: number;
    userId: number;
}
// 修改角色
export const updateRole = (data: UpdateRole) => post("/user/updateRole", data);
